package com.laozhao.test;

/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */


import java.beans.PropertyChangeListener;
import java.beans.PropertyChangeSupport;
import java.io.Serializable;
import java.util.Date;

/**
 *
 * @author LaoZhao
 */
//@Entity
//@Table(name = "book", catalog = "zhaomysql", schema = "")
//@NamedQueries({@NamedQuery(name = "Book.findAll", query = "SELECT b FROM Book b"), @NamedQuery(name = "Book.findById", query = "SELECT b FROM Book b WHERE b.id = :id"), @NamedQuery(name = "Book.findByBookCode", query = "SELECT b FROM Book b WHERE b.bookCode = :bookCode"), @NamedQuery(name = "Book.findByBoookName", query = "SELECT b FROM Book b WHERE b.boookName = :boookName"), @NamedQuery(name = "Book.findByInsertdAte", query = "SELECT b FROM Book b WHERE b.insertdAte = :insertdAte"), @NamedQuery(name = "Book.findByInsertUser", query = "SELECT b FROM Book b WHERE b.insertUser = :insertUser")})
public class Book implements Serializable {
//    @Transient
    private PropertyChangeSupport changeSupport = new PropertyChangeSupport(this);
    private static final long serialVersionUID = 1L;
//    @Id
//    @Basic(optional = false)
//    @Column(name = "id")
    private String id;
//    @Basic(optional = false)
//    @Column(name = "book_code")
    private String bookCode;
//    @Column(name = "boook_name")
    private String boookName;
//    @Column(name = "insertd_ate")
//    @Temporal(TemporalType.TIMESTAMP)
    private Date insertdAte;
//    @Column(name = "insert_user")
    private String insertUser;

    public Book() {
    }

    public Book(String id) {
        this.id = id;
    }

    public Book(String id, String bookCode) {
        this.id = id;
        this.bookCode = bookCode;
    }

    public String getId() {
        return id;
    }

    public void setId(String id) {
        String oldId = this.id;
        this.id = id;
        changeSupport.firePropertyChange("id", oldId, id);
    }

    public String getBookCode() {
        return bookCode;
    }

    public void setBookCode(String bookCode) {
        String oldBookCode = this.bookCode;
        this.bookCode = bookCode;
        changeSupport.firePropertyChange("bookCode", oldBookCode, bookCode);
    }

    public String getBoookName() {
        return boookName;
    }

    public void setBoookName(String boookName) {
        String oldBoookName = this.boookName;
        this.boookName = boookName;
        changeSupport.firePropertyChange("boookName", oldBoookName, boookName);
    }

    public Date getInsertdAte() {
        return insertdAte;
    }

    public void setInsertdAte(Date insertdAte) {
        Date oldInsertdAte = this.insertdAte;
        this.insertdAte = insertdAte;
        changeSupport.firePropertyChange("insertdAte", oldInsertdAte, insertdAte);
    }

    public String getInsertUser() {
        return insertUser;
    }

    public void setInsertUser(String insertUser) {
        String oldInsertUser = this.insertUser;
        this.insertUser = insertUser;
        changeSupport.firePropertyChange("insertUser", oldInsertUser, insertUser);
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (id != null ? id.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof Book)) {
            return false;
        }
        Book other = (Book) object;
        if ((this.id == null && other.id != null) || (this.id != null && !this.id.equals(other.id))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "bookmanager.Book[id=" + id + "]";
    }

    public void addPropertyChangeListener(PropertyChangeListener listener) {
        changeSupport.addPropertyChangeListener(listener);
    }

    public void removePropertyChangeListener(PropertyChangeListener listener) {
        changeSupport.removePropertyChangeListener(listener);
    }

}